import 'package:dio/dio.dart';
import 'dart:io';
import 'dart:async';
import '../config/service_url.dart';

Future getHomePageContent() async {
  print('开始获取首页数据..........');

  Response response;
  Dio dio = Dio();

  // dio.options.contentType = ContentType.parse("application/x-www-form-urlencoded");
  dio.options.contentType = 'application/x-www-form-urlencoded';
  var formData = {'lon': '115.029', 'lat': '35.79645'};
  response = await dio.post(servicePath['homePageContent'], data: formData);

  if (response.statusCode == 200) {
    return response.data;
  } else {
    throw Exception('后端接口出现异常。');
  }
}